<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title><fmt:message code="document.th.Sealmanagement"/></title>
    <%--<link rel="stylesheet" type="text/css" href="../lib/laydate.css"/>--%>
    <%--<link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>--%>
    <%--<link rel="stylesheet" type="text/css" href="../css/base.css"/>--%>
    <script src="/lib/jQuery-File-Upload-master/jquery-1.8.3.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/layer/layer.js?20201106"></script>
    <script src="/js/ajaxupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <%--<script src="../lib/common/websign_main.js"></script>--%>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 微软雅黑;
            overflow-y: hidden;
        }

        .bx {
            width: 100%;
        }

        .navigation {
            height: 70px;
            width: 100%;
            border-bottom: #ccc 1px solid;
            line-height: 70px;
        }

        .navigation img {
            float: left;
            margin-top: 20px;
            margin-left: 30px;
            margin-right: 10px;
        }

        .navigation .news {
            float: left;
            font-size: 22px;
        }

        .tab {
            margin: 10px auto;
        }

        a {
            text-decoration: none;
        }

        .tab tr {
            border: #ccc 1px solid;
        }

        .tab tr td {
            border-right: #ccc 1px solid;
            padding: 6px;
            font-size: 14px;
        }

        .tab tr td input[type="text"] {
            height: 28px;
            width: 260px;
            padding-left: 5px;
        }

        .tab tr td select {
            height: 28px;
            width: 200px;
        }

        .divBtn {
            width: 100%;
        }

        .divBtn .buildSeal {
            background: url("../img/document/btn_makeseal_03.png");
            font-size: 14px;
            margin: 10px auto;
            width: 93px;
            height: 28px;
            line-height: 28px;
            /*border: #ccc 1px solid;*/
            /*border-radius: 5px;*/
            /*text-align: center;*/
            cursor: pointer;
        }

        .divBtn1 .buildSeal {
            background: url("../img/document/btn_makeseal_03.png");
            font-size: 14px;
            margin: 10px auto;
            width: 93px;
            height: 28px;
            line-height: 28px;
            /*border: #ccc 1px solid;*/
            /*border-radius: 5px;*/
            /*text-align: center;*/
            cursor: pointer;
        }

        .divBtn2 .buildSeal {
            background: url("../img/document/btn_makeseal_03.png");
            font-size: 14px;
            margin: 10px auto;
            width: 93px;
            height: 28px;
            line-height: 28px;
            /*border: #ccc 1px solid;*/
            /*border-radius: 5px;*/
            /*text-align: center;*/
            cursor: pointer;
        }

        .divBtn2 .buildSeal {
            background-color: gainsboro;
            font-size: 14px;
            margin: 10px auto;
            width: 120px;
            height: 28px;
            line-height: 28px;
            /*border: #ccc 1px solid;*/
            /*border-radius: 5px;*/
            /*text-align: center;*/
            cursor: pointer;
        }

        .imgBox {
            margin: 10px auto;
            width: 200px;
            height: 200px;
        }

        .changeFile {
            margin: 10px auto;
            text-align: center;
            width: 120px;
            height: 28px;
            border-radius: 5px;
            border: #ccc 1px solid;
            cursor: pointer;
            line-height: 28px;
        }

        a {
            cursor: pointer;
        }

        .TableHeader{
            border: 1px solid #ccc;
        }
       td{
            border: 1px solid #ccc;
        }

    </style>
</head>
<body>
<div class="bx">
    <!--head开始-->
    <%--<div class="head w clearfix">--%>
    <%--<ul class="index_head">--%>
    <%--<li data_id="0" data-num="0"><span class="one headli1_1">点聚<fmt:message code="document.th.To-doList" /></span><img class="headli1_2" src="../img/twoth.png" alt=""/>--%>
    <%--</li>--%>
    <%----%>
    <%--<li data_id="" data-num="1"><span class="headli2_1"><fmt:message code="document.th.InOffice" /></span><img src="../img/twoth.png" alt="" class="headli2_2"/>--%>
    <%--</li>--%>
    <%----%>
    <%--<li data_id="1" data-num="2"><span class="headli3"><fmt:message code="document.th.AnOfficial" /></span></li>--%>
    <%----%>
    <%--</ul>--%>
    <%--<div class="new_liucheng" style="padding-left:25px;margin-top: 10px;"><h1 style="line-height: 30px;overflow: hidden;text-overflow: ellipsis;white-space: normal;width: 70px" ><fmt:message code="document.th.NewOfficial" /></h1></div>--%>
    <%--</div>--%>
    <!--head通栏结束-->

    <!--navigation开始-->
    <div class="navigation  clearfix">
        <img src="/img/commonTheme/${sessionScope.InterfaceModel}/yinzhang.png">
        <div class="news">
            <%-- <fmt:message code="document.th.Sealmaking"/>--%>
            点聚印章制作
        </div>
    </div>

    <!--navigation结束-->

    <!--content部分开始-->
    <div class="content">
        <table cellspacing="0" cellpadding="0" class="tab"
               style="border-collapse:collapse;background-color: #fff;width: 80%;">
            <tr>
                <td><fmt:message code="document.th.SealId"/></td>
                <td><input type="text" name="years" value="2019" id="sealId1" disabled
                           style="width: 120px;"><span>-</span><input type="text" name="number" id="sealId2" value=""
                                                                      maxlength="2" style="width: 120px;"><span>-</span><input
                        type="text" value="" id="sealId3" disabled style="width: 120px;"></td>
                <td rowspan="9" style="width: 45%;">
                    <div class="imgBox">
                        <OBJECT id=DMakeSealV61 style="left: 0px; top: 0px" classid="clsid:3F1A0364-AD32-4E2F-B550-14B878E2ECB1" VIEWASTEXT width="200" height="200" codebase='/lib/webSign/MakeSealV6.ocx#Version=1,1,2,2'>
                            <PARAM NAME="_Version" VALUE="65536">
                            <PARAM NAME="_ExtentX" VALUE="2646">
                            <PARAM NAME="_ExtentY" VALUE="1323">
                            <PARAM NAME="_StockProps" VALUE="0">
                        </OBJECT>
                    </div>
                    <div class="changeFile">
                        <form id="uploadimgform" target="uploadiframe" action="/upload?module=seal" method="post" style="position:relative;">
                            <input type="button" name="SelBMPFile" id="SelBMPFile" class="w-icon5" style="position: absolute;opacity: 0;width: 120px;left: 0;height: 28px;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0)">
                            <a href="#" id="uploadimg"><img style="margin-right:5px;"
                                                            src="../img/icon_uplod.png"/><fmt:message
                                    code="global.th.fileup"/></a>
                        </form>
                    </div>
                </td>
            </tr>
            <tr>
                <td><fmt:message code="document.th.SealName"/></td>
                <td><input type="text" name="sealName" value="" id="sealName"></td>
            </tr>
            <tr>
                <td>印章密码</td>
                <td><input type="password" name="sealName" id="SealPwd" value="" ></td>
            </tr>
            <tr>
                <td>确认密码</td>
                <td><input type="password" name="re_SealPwd" id="re_SealPwd" value=""></td>
            </tr>
            <tr>
                <td><fmt:message code="document.th.SealDept"/></td>
                <td>
                    <%--<select name="sealDept" id="sealDept">--%>
                    <%--&lt;%&ndash;<option value="1">董事会</option>&ndash;%&gt;--%>
                    <%--</select>--%>
                    <input class="td_title1" type="text" style="width: 200px" id="sealDept"/>

                    <a class="release3 addDept"><fmt:message code="global.lang.add"/></a>
                    <a class="release3 clearDept"><fmt:message code="notice.th.delete1"/></a>
                </td>
            </tr>
            <tr>
                <td>图片宽度</td>
                <td><input type="text" name="picWidth" id="SealWidth" value=""><span>mm</span></td>
            </tr>
            <tr>
                <td>图片高度</td>
                <td><input type="text" name="picHeight" id="SealHeight" value=""><span>mm</span></td>
            </tr>
            <tr>
                <td>印章大小</td>
                <td>
                    <select name="sealSize" id="sealSize">
                        <option value="1">图片与印章等大</option>
                        <option value="2">图片2倍与印章</option>
                        <option value="3">图片3倍与印章</option>
                    </select>
                    <span style="font-size: 12px;">图片大，则印章打印清晰</span>
                </td>
            </tr>
            <tr>
                <td>图片深度</td>
                <td>
                    <select name="sealDepth" id="sealDepth">
                        <option value="1">单色显示</option>
                        <option value="2">16色显示</option>
                        <option value="3">256色显示</option>
                        <option value="4">24位真彩色</option>
                    </select>
                    <span style="font-size: 12px;">色彩位数越高，打印越清晰</span>
                </td>
            </tr>
            <%--<tr>--%>
            <%--<td><fmt:message code="document.th.Sealdocument" /></td>--%>
            <%--<td>--%>
            <%--<div class="attmend"></div>--%>
            <%----%>
            <%--</td>--%>
            <%--</tr>--%>
        </table>
        <div style="width: 410px;margin: 0 auto;">
            <div class="divBtn" style="width: 100px;float: left">
                <input type="hidden" name="SEAL_DATA" id="SEAL_DATA">
                <input type="hidden" name="KeyID" id="KeyID">
                <div class="buildSeal"><span style="margin-left: 30px;" id="makeSeals"><fmt:message code="document.th.Generateseal"/></span>
                </div>
            </div>
            <div class="divBtn1" style="width: 100px;float: left;margin-left: 20px;">
                <div class="buildSeal" style="display: inline-block"><span style="margin-left: 30px;" id="sealToUkey">写入Ukey</span></div>
            </div>
            <div class="divBtn1" style="width: 100px;float: left;margin-left: 20px;">
                <div class="buildSeal" style="display: inline-block"><span style="margin-left: 30px;" id="ukeySeal">读取Ukey</span></div>
            </div>
        </div>

    </div>
    <table cellspacing="0" cellpadding="0" style="display:none" id="seallisttable" class="TableList tab" align="center" width="80%">
        <tbody><tr class="TableHeader">
            <td>ID</td>
            <td>名称</td>
            <td>规格(mm)</td>
            <td>签名</td>
            <td>证书数量</td>
            <td>操作</td>
        </tr>
        </tbody></table>
</div>


<script>
    var sign_user = "admin";
    var sign_number = "02 ";
    var certdata_array = new Array(); //添加的证书绑定的数量
    $(function () {
        // 添加部门信息
        $(".addDept").on("click", function () {
            dept_id = "sealDept";
            $.popWindow("../common/selectDept");
        });
        // 清空部门信息
        $('.clearDept').click(function () {
            $('#sealDept').attr("deptid", "");
            $('#sealDept').attr("deptno", "");
            $('#sealDept').val("");
        });


        //附件删除
        $('.attmend').on('click', '.deImgs', function () {
            var data = $(this).parents('.dech').attr('deUrl');
            var dome = $(this).parents('.dech');
            deleteChatment(data, dome);
        })

    })

    //失去焦点时获取印章编号
    $("#sealId2").blur(function () {
        if ($('#sealId2').val() == "") {
            $.layerMsg({content: "<fmt:message code="document.th.NoID" />", icon: 2}, function () {
            });
        } else {
            $.ajax({
                url: '/seal/getSealIdById',
                dataType: 'json',
                data: {id: $('#sealId1').val().toString() + $('#sealId2').val().toString()},
                success: function (obj) {
                    if (obj.object != undefined) {
                        $('#sealId3').val(obj.object);
                    }

                }
            })
        }
    });

    $('#makeSeals').click(function () {
        SealWriteToKey_onclick(0)
    })

    $('#sealToUkey').click(function () {
        SealWriteToKey_onclick(1)
    })

    $('#makeSeal').click(function () {
        var sealId = $('#sealId1').val().toString() + $('#sealId2').val().toString() + $('#sealId3').val().toString();
        var sId = '';
        var uId = '';
        for (var i = 0; i < $('.attmend .inHidden').length; i++) {
            sId += $('.attmend .inHidden').eq(i).val();
        }
        for (var i = 0; i < $('.attmend .inHidden').length; i++) {
            uId += $('.attmend a').eq(i).attr('NAME');
        }
        /* var sId = $('.attmend .inHidden').val();
         var uId = $('.attmend a').attr('NAME');*/
        var sealName = $('#sealName').val();
        data = {
            sealId: sealId,
            sealName: $('#sealName').val(),
            deptId: $('#sealDept').attr('deptid'),
            attachmentId: sId,
            attachmentName: uId
        }
        if (sId == "" || sId == undefined) {
            $.layerMsg({content: "<fmt:message code="document.th.pleaseSealaccessories" />", icon: 2}, function () {
            });
        } else {
            //判断附件格式是否正确
            var s = uId.substring(uId.length - 5, uId.length - 1);
            var arr = uId.split("*");
            if (arr.length <= 2) {
                //如果不是正确的附件
                if (s != ".sel") {
                    $.layerMsg({
                        content: "<fmt:message code="document.th.pleaseCorrectAttach" />",
                        icon: 2
                    }, function () {
                    });
                } else {
                    if ($('#sealId2').val().toString() != "") {
                        //自定义印章名称不能为空
                        if (sealName == "") {
                            $.layerMsg({
                                content: "<fmt:message code="document.th.NosealName" />",
                                icon: 2
                            }, function () {
                            });
                        } else {
                            $.ajax({
                                url: '/seal/getSealLogBySealId',
                                dataType: 'json',
                                data: {sealId: sealId},
                                success: function (obj) {
                                    if (obj.object == undefined) {
                                        $.ajax({
                                            url: '/seal/addSealObject',
                                            dataType: 'json',
                                            data: data,
                                            success: function (obj) {
                                                if (obj.flag) {
                                                    $.layerMsg({
                                                        content: "<fmt:message code="document.th.Successfulproduction" />",
                                                        icon: 1
                                                    }, function () {
                                                        document.location.reload()
                                                    });
                                                }
                                            }
                                        })
                                    } else {
                                        $.layerMsg({
                                            content: "<fmt:message code="document.th.pleaseNorepeatID" />",
                                            icon: 2
                                        }, function () {
                                        });
                                    }
                                }
                            })
                        }

                    }
                    else {
                        $.layerMsg({content: "<fmt:message code="document.th.pleaseID" />", icon: 2}, function () {
                        });
                    }
                }
            } else {
                $.layerMsg({content: "<fmt:message code="document.th.pleaseOneAttach" />", icon: 2}, function () {
                });
            }
        }
    })

    //
    // $("#sealToUkey").click(function () {
    //     var obj = document.getElementById("DMakeSealV61");
    //     if (!obj) {
    //         alert("尚未安装控件");
    //         return false;
    //     }
    //     obj.NewSealStart();
    //     var vBmpHeightMM = parseInt($("#SealWidth").val() * 100) / 100;
    //     var vBmpWidthMM = parseInt($("#SealHeight").val() * 100) / 100;
    //     if (vBmpHeightMM == 0 || vBmpWidthMM == 0) {
    //         //alert("BMP图片错误");
    //         return false;
    //     }
    //     //设置印章数据
    //     obj.fSealWidthMM = $("#SealWidth").val() / $("#sealSize").val();
    //     obj.fSealHeightMM = $("#SealHeight").val() / $("#sealSize").val();
    //     obj.strSealName = $("#sealName").val();
    //     obj.strSealID = $('#sealId1').val().toString() + $('#sealId2').val().toString() +       $('#sealId3').val().toString();
    //
    //     obj.strOpenPwd = $("#SealPwd").val();
    //
    //     obj.strCompName = $("#sealDept").val();
    //     obj.lBitCount = $("#sealDepth").val();
    //     if(0 != obj.NewSealEnd()){
    //         //不写key先清空当前对象数据 add by lx 20090420
    //         return false;
    //     }
    //
    //     //obj.LoadSeal(1,"./123.sel",0);
    //
    //     obj.SaveData();
    //     var sealid = 0;
    //     while (sealid = obj.GetNextSeal(sealid)) {
    //         obj.SelectSeal(sealid);
    //     }
    //     var result = obj.SaveSeal(2, "", 0);
    //     if(0 != obj.NewSealEnd()){
    //         //不写key先清空当前对象数据 add by lx 20090420
    //         return false;
    //     }
    //     if (result == 0) {
    //         $.layerMsg("写入成功",{icon:6});
    //     } else {
    //         $.layerMsg("写入失败",{icon:5});
    //     }
    // })

    $("#ukeySeal").click(function () {
        GetSealData();
    })

    $("#SelBMPFile").click(function () {
        SelBMPFile_onclick();
    })

    function SelBMPFile_onclick(){
        var obj = document.getElementById("DMakeSealV61");
        if(!obj){
            return false;
        }
        if(0 != obj.SelectBmpFile())
            return false;

        var vBmpHeightMM = parseInt(obj.fBmpHeightMM*100)/100;
        var vBmpWidthMM = parseInt(obj.fBmpWidthMM*100)/100;
        if(vBmpHeightMM == 0  || vBmpWidthMM == 0){
            //alert("BMP图片错误");
            return false;
        }
        $("#SealWidth").val(vBmpWidthMM);
        $("#SealHeight").val(vBmpHeightMM);

    }


    function SaveSeal() {
        var obj = document.getElementById("DMakeSealV61");
        if (!obj) {
            return false;
        }
        var vBmpHeightMM = parseInt($("SealWidth").value * 100) / 100;
        var vBmpWidthMM = parseInt($("SealHeight").value * 100) / 100;
        if (vBmpHeightMM == 0 || vBmpWidthMM == 0) {
            //alert("BMP图片错误");
            return false;
        }
        //设置印章数据
        obj.fSealWidthMM = document.getElementById("SealWidth").value / document.getElementById("sealSize").value;
        obj.fSealHeightMM = document.getElementById("SealHeight").value / document.getElementById("sealSize").value;
        obj.strSealName = document.getElementById("sealName").value;
        obj.strSealID = document.getElementById('sealId1').value.toString() + document.getElementById('sealId2').value.toString() + document.getElementById('sealId3').value.toString();

        obj.strOpenPwd = document.getElementById("SealPwd").value;

        obj.strCompName = document.getElementById("sealDept").value;
        obj.lBitCount = document.getElementById("sealDepth").value;

        /*
        if($("checkboxSign").checked){
             obj.blNeedSign = 1;
        }
        */
    }

    function SealWriteToKey_onclick(key_flag) {
        // 先判断密码是否合法
        if ($('#SealPwd').val()=='') {
            alert("签章密码不能为空");
            return false;
        }
        else if ($('#SealPwd').val()!=$('#re_SealPwd').val()) {
            alert("两次密码输入不一致");
            return false;
        }
        var obj = document.getElementById("DMakeSealV61");
        console.log(obj)
        if (!obj) {
            alert("尚未安装控件");
            return false;
        }
        //写入key
        if (key_flag == 0) {
            var vID = 0;
            do {
                vID = obj.GetNextSeal(vID);
                if (!vID)
                    break;
                obj.DelSeal(vID);
            } while (vID);
        }
        obj.NewSealStart();
        SaveSeal();
        if (0 != obj.NewSealEnd()) {
            //不写key先清空当前对象数据 add by lx 20090420
            return false;
        }

        var vLen = certdata_array.length;
        //alert("载入BMP图片失败");
        for (i = vLen - 1; i >= 0; i--) {
            obj.AddCtrlCert(4, certdata_array[i], 15, 7);
        }

        $("input[name='SEAL_DATA']").val(obj.SaveData());
        if ($("input[name='SEAL_DATA']").val().length > 64 * 1024) {
            alert("印章数据大小已超过64k,\n请修改图片大小或者降低色彩位数");
            return false;
        }

        if (key_flag == 1) {
            //设置绑定证书
            /*
            var msg = "是否已经插入要写入签章的KEY?\n\n选择否则取消制章."
            while(sign_user == CertGetInfo("0") || sign_number == CertGetInfo("1"))
            {
                if(window.confirm(msg))
                continue;
              else
                 return;
            }
            */

            //判断KeyID
            obj.AddSealData($("input[name='SEAL_DATA']").val());

            if (0 != obj.SaveSeal(2, "", 0)) {
                alert("制作印章失败");
                return false;
            } else {
                $.ajax({
                    type:'post',
                    url:'/seal/addSealObject',
                    dataType:'json',
                    data:{
                        sealData:$("input[name='SEAL_DATA']").val(),
                        sealName:$("input[name='sealName']").val(),
                        deptId:$("#sealDept").attr('deptid'),
                        sealId:$("#sealId1").val() + $("#sealId2").val() + $("#sealId3").val()
                    },
                    success:function(rsp){
                        if(rsp.flag == true){
                            alert("制作印章成功！");
                            obj.ResetContent();
                            location.reload();

                        }else{
                            $.layerMsg({content:'<fmt:message code="global.lang.err" />！',icon:2},function(){
//										console.log(rsp.flag);
                            });
                        }
                    }
                });
                //obj.LoadSeal(2,"",0);
                // _post("create.php", "SealID=" + $("SealID").value + "&SealName=" + $("SealName").value + "&SEAL_DATA=" + $("SEAL_DATA").value.replace(/\+/g, '%2B') + "&DEPT_ID=" + $("CompName").value, function () {
                //     alert("制作印章成功！");
                //     location.reload();
                // });
            }
        }
        else {
            console.log($("input[name='SEAL_DATA']").val())
            //印章制作成功，写入后台数据库数据
         //   _post("create.php", "SealID=" + $("SealID").value + "&SealName=" + $("SealName").value + "&SEAL_DATA=" + $("SEAL_DATA").value.replace(/\+/g, '%2B') + "&DEPT_ID=" + $("CompName").value, function (req) {
            // });
            $.ajax({
                type:'post',
                url:'/seal/addSealObject',
                dataType:'json',
                data:{
                    sealData:$("input[name='SEAL_DATA']").val(),
                    sealName:$("input[name='sealName']").val(),
                    deptId:$("#sealDept").attr('deptid'),
                    sealId:$("#sealId1").val() + $("#sealId2").val() + $("#sealId3").val()
                },
                success:function(rsp){
                    if(rsp.flag == true){
                        alert("制作印章成功！");
                        location.reload();

                    }else{
                        $.layerMsg({content:'<fmt:message code="global.lang.err" />！',icon:2},function(){
//										console.log(rsp.flag);
                        });
                    }
                }
            });
        }
        //印章制作成功，写入后台数据库数据
         obj.ResetContent();
        clear_option();
    }

    function clear_option() {
        var obj = document.getElementsByTagName("input");
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].type == "text") obj[i].value = "";
            else if (obj[i].type == "checkbox") obj[i].checked = false;
        }
    }

    // function GetSealData() {
    //     var obj = document.getElementById("DMakeSealV61");
    //     obj.LoadSeal(2, "", 0);
    //     var sealid = 0;
    //     while (sealid = obj.GetNextSeal(sealid)) {
    //         obj.SelectSeal(sealid);
    //         showUkey(obj);
    //     }
    // }

    function GetSealData(){
        var obj = document.getElementById("DMakeSealV61");
        if(!obj){
            return false;
        }
        if(0 == obj.LoadSeal(2,"",0)){
            $("input[name='SEAL_DATA']").val(obj.SaveData());
            //清空数据
            ReFlush_SealListTable();
        }else{
            alert("读取EKey印章失败");
        }
        return;
    }



    //刷新
    function ReFlush_SealListTable(){
        var obj;
        obj = document.getElementById("DMakeSealV61");
        if(!obj){
            return false;
        }
        //刷新印章列表
        Clear_SealListTabale();
        var vID = 0;
        var vCount = 0;
        do{
            //以下为刷新印章列表
            vID = obj.GetNextSeal(vID);
            if(!vID){
                break;
            }
            if(obj.SelectSeal(vID)) break;
            var vSealID = obj.strSealID;
            var vSealName = obj.strSealName;
            //获取ID
            var vSealWidth = parseInt((obj.fSealWidthMM+0.005) * 100 )/100;
            var vSealHeight = parseInt((obj.fSealHeightMM+0.005)  * 100 )/100;
            var vCertCtrlNum = 0
            var vCertID = 0 ;
            var vInfo = "";
            var vSignInfo = "";
            var vTempFilePath = "";
            while(vCertID = obj.GetNextCtrlCert(vCertID)){
                vTempFilePath = obj.GetTempFilePath();
                if(0 == obj.GetCtrlCert(vCertID,vTempFilePath)){
                    if(0 == obj.CertGetInfo(vTempFilePath,"CERTDATAFILE") ){
                        vInfo +="<br>用户:" + obj.SubjectName+"  序列号:" + obj.SerialNumber;
                    }
                    obj.DelLocalFile(vTempFilePath);
                }
                vCertCtrlNum ++;
            }
            vInfo = "绑定的证书数量:"+vCertCtrlNum+vInfo;

            vTempFilePath = obj.GetSignCert(0);
            if("" != vTempFilePath){
                if(0 == obj.CertGetInfo(vTempFilePath,"CERTDATAFILE") ){
                    vSignInfo ="用户:" + obj.SubjectName+"  序列号:" + obj.SerialNumber;
                }
                obj.DelLocalFile(vTempFilePath);
            }

            vCount++;
            InserRow_SealListTabale(vSealID,vSealName,vSealWidth + "*" + vSealHeight, vSignInfo,vInfo,vID,vCount);
        }while(vID);
        document.getElementById("seallisttable").style.display="";
    }

    //以下数据 四舍五入 显示
    function InserRow_SealListTabale(id,name,wh,issign,certInfo,vID,vCount){
        var obj;
        obj = document.getElementById("seallisttable");
        if(!obj){
            return false;
        }
        var option = "<a href = '#' onclick = 'javascript=ViewSeal("+vID+")'>查看<a>";
        //插入记录
        var oRow1=obj.insertRow();
        if(vCount%2 ==1)
            oRow1.className = "TableLine1";
        else
            oRow1.className = "TableLine2";
        var oCell = oRow1.insertCell();
        oCell.innerHTML = id;
        oCell = oRow1.insertCell();
        oCell.innerHTML = name;
        oCell = oRow1.insertCell();
        oCell.innerHTML = wh;
        oCell = oRow1.insertCell();
        oCell.innerHTML = issign;
        oCell = oRow1.insertCell();
        oCell.innerHTML = certInfo;
        oCell = oRow1.insertCell();
        oCell.innerHTML = option;
    }



    function Clear_SealListTabale(){
        var obj = document.getElementById("seallisttable");
        if(!obj){
            return false;
        }
        var colcount=obj.rows.length;
        if(colcount < 2 ){return false};
        for(var i=1;i<colcount;i++){
            obj.deleteRow(1);
        }
    }





    function showUkey(obj){
        layer.open({
            title:'印章信息',
            type:1,
            area: ['400px', '300px'],
            content:$('#showUkey'),
            success:function (obj) {
                document.getElementById('sealId').innerText = obj.strSealID;
                document.getElementById('sealKeyName').innerText = obj.strSealName;

            }

        })


    }






</script>
</body>
<div id="showUkey" style="text-align: center; display: none">
    印章编号：<input type="text" id="sealId"><br><br>
    印章名称：<input type="text" id="sealKeyName">
</div>

</html>
